home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
powerb5.zip
/
P5SPR001.TIP
< prev
next >
Wrap
Text File
|
1993-06-01
|
2KB
|
41 lines
File-saving 1-2-3 macros present a problem: When you write
the macro, you don't know whether the user will be given a
`Cancel or Replace' option. For instance, the macro
statement `/fsWIDGET\X' will save the current worksheet
under the name WIDGET--if WIDGET.WK1 is not already in
existence. But when the macro is used to save the file a
second time, 1-2-3 will ask the user whether the current
version should be replaced.
There is a solution: With the help of the {OPEN} and {CLOSE}
macro commands, you can ensure the existence of a file to be
overwritten by creating one automatically. This two-line
macro demonstrates the technique: {OPEN
"WIDGET.WK1",W}{CLOSE} /fsWIDGET\Xr
The {OPEN} command tells the program to open a file named
WIDGET.WK1 for output. {CLOSE} then closes the file
unchanged. If the file doesn't already exist, these two
commands create it--empty and ready to be overwritten. The
next line instructs 1-2-3 to save the worksheet file,
replacing the file already on the disk.
This technique can be used whenever a macro uses a command
that writes to disk, such as File Save, File eXtract, and
Print File.
James R. Knoblock
Bridgeport, West Virginia
Editor's Note: For another technique that accomplishes the
same function even more simply, see the tip "Unconditional
Save Redux" (also on this PowerBase *.* Volume 5 menu).
Title: Unconditional Save for 1-2-3
Category: SPR
Issue Date: February, 1992
Editor: Brett Glass
Supplementary Files: None
Filename: P5SPR001.TIP